package com.yunying.rispro.service.impl;

import com.yunying.rispro.exception.BusinessException;
import com.yunying.rispro.model.Equipment;
import com.yunying.rispro.mapper.EquipmentMapper;
import com.yunying.rispro.service.IEquipmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunying.rispro.util.JsonResponseBody;
import com.yunying.rispro.util.JsonResponseStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 检查设备表 服务实现类
 * </p>
 *
 * @author yunying
 * @since 2022-04-21
 */
@Service
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment> implements IEquipmentService {

    @Autowired
    private EquipmentMapper equipmentMapper;

    @Override
    public JsonResponseBody<?> addEquipment(Equipment equipment) {
        equipment.setEquipmentId(30+new Date().getTime());
        int i=equipmentMapper.insertEquipment(equipment);
        if(i<0){
            throw new BusinessException(JsonResponseStatus.OPERATE_ERROR);
        }
        return new JsonResponseBody<>();
    }
}
